feat(opencode): show quota usage toast after quota refresh#26
Closed
iceteaSA wants to merge 2 commits into
Closed
Conversation
bb1169c to
aec50fa
Compare
Unified quota cache and API gateway for main + fallback quota state. All consumers share one QuotaManager instance for consistent caching. Features: - Inflight deduplication prevents concurrent API calls - Exponential backoff (60s-15min) for 429/5xx errors - Persists main quota and backoff state to disk via callbacks - Cross-process file lock guard for quota API dedup - Seeds from persisted storage on construction - Integrates with FallbackAccountManager for shared staleness - Captures storage path at init to prevent test config corruption - Request-count-based refresh trigger (refreshEveryNRequests)
Displays quota usage bar notifications via client.tui.showToast after quota data is refreshed. Shows main and fallback account usage with visual bars, percentage, and reset time. Toast variant reflects severity (info < 70%, warning >= 70%, error >= 90%).
aec50fa to
4e7ccc0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Displays a visual toast notification with quota usage bars after each quota cache refresh. Shows usage for both main and fallback accounts.
Example output
Behavior
refreshMainQuotaCachecompletes (quota routing path)info— usage below 70%warning— 70-90%error— 90%+ (longer duration: 8s vs 5s)client.tui.showToast— gracefully no-ops if TUI is unavailableFiles changed
packages/opencode/src/index.ts— addsquotaBar()andshowQuotaToast()utilities, calls fromrefreshMainQuotaCacheTesting
All 214 tests pass. Toast is fire-and-forget with
.catch(() => {})— no impact on request latency.